<html>
<head>
<script>
  function selectLink1() {
    var selection = window.getSelection();
    var range = document.createRange();
    range.setStartBefore(document.getElementById('link1'));
    range.setEndAfter(document.getElementById('link1'));
    selection.addRange(range);
    return "";
  }
</script>
</head>
<body>
  google has many links on google.
  here is a <a id="link1" href="http://www.google.com">link</a>
  to <a id="link2" href="http://www.google.com">google</a>, where
  you will find google.

  <br><br><br>
  <div id="log"><div>
</body>
</html>